<template>
    <view class="content">
        <view class="nav">
            <scroll-view scroll-x>
                <view class="nav-list">
                    <view :class="{active : type == 1}" @click="chooseNav(1)">销售信息</view>
                    <view :class="{active : type == 2}" @click="chooseNav(2)">建筑规划</view>
                    <view :class="{active : type == 3}" @click="chooseNav(3)">物业信息</view>
                    <view :class="{active : type == 4}" @click="chooseNav(4)">其他信息</view>
                    <view :class="{active : type == 5}" @click="chooseNav(5)">基础信息</view>
                </view>
            </scroll-view>
        </view>
        
        <view class="wrapper">
            <view class="item">
                <view class="name">{{ title }}</view>
                <view class="list">
                    <!-- <view class="list-l">销售状态</view> -->
                    <!-- <view class="list-r">在售</view> -->
                    <u-parse :html="content"></u-parse>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                id: '',
                data: {},
                type: 1,
                content: '',
                title: '销售信息',
            };
        },
        onLoad(option) {
            this.id = option.id
            this.getData()
        },
        methods: {
            chooseNav(num) {
                this.type = num
                if (num == 1) {this.content = this.data.sale_msg; this.title = '销售信息'}
                if (num == 2) {this.content = this.data.build_msg; this.title = '建筑规划'}
                if (num == 3) {this.content = this.data.property_msg; this.title = '物业信息'}
                if (num == 4) {this.content = this.data.other_msg; this.title = '其他信息'}
                if (num == 5) {this.content = this.data.base_msg; this.title = '基础信息'}
            },
            getData() {
                this.$ajax('properties_detail', {
                    user_token: this.$getSync('userToken'),
                    id: this.id,//楼盘id
                }).then(ret => {
                    if (ret.success == 1000) {
                        this.data = ret.detail
                        this.content = ret.detail.sale_msg
                    } else {
                        this.$toast(ret.msg);
                    }
                });
            },
        }
    };
</script>

<style lang="scss">
    page{
        background-color: #f5f5f5;
    }
    .nav{
        width: 100vw;
        white-space: nowrap;
        background-color: #fff;
        border-top: 2rpx solid #e6e6e6;
        margin-bottom: 16rpx;
    }
    .nav-list{
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
    }
    .nav-list>view{
        text-align: center;
        padding: 25rpx;
        font-size: 26rpx;
    }
    .active{
        font-size: 28rpx;
        font-weight: bold;
        color: #00a1e9;
        border-bottom: 2rpx solid #00a1e9;
    }
    
    .wrapper{
        background-color: #fff;
        padding: 0 20rpx;
    }
    .item{
        padding: 35rpx 0;
        border-bottom: 2rpx solid #e6e6e6;
    }
    .item:last-child{
        border-bottom: none;
    }
    .name{
        font-size: 36rpx;
        font-weight: bold;
        padding-left: 20rpx;
        position: relative;
    }
    .name::after{
        display: block;
        content: '';
        width: 6rpx;
        height: 32rpx;
        background-color: #fe6155;
        position: absolute;
        top: 10rpx;
        left: 0;
    }
    .list{
        padding-top: 20rpx;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .list-l{
        color: #747272;
        padding-right: 20rpx;
    }
    .list-r{
        flex: 1;
    }
    
</style>
